package icu.sehnen.service;

import icu.sehnen.dao.NewsDao;
import icu.sehnen.model.NewsModel;

import java.util.ArrayList;
import java.util.List;

public class NewsService {

    public List<NewsModel> getNewsModelForHome() {
        List<NewsModel> newsModelList=new ArrayList<>();
        NewsDao newsDao=new NewsDao();
        Integer length=newsDao.content.size();
        for (int i=0;i<length ;i++){
            NewsModel newsModel=new NewsModel();
            newsModel.setDate(newsDao.date.get(i));
            newsModel.setImgUrl(newsDao.imgUrl.get(i));
            newsModel.setTitle(newsDao.title.get(i));
            newsModel.setContent(newsDao.content.get(i));
            newsModelList.add(newsModel);
        }
        return newsModelList;

    }
}
